home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / win / pascal / beepr.com / BEEPER.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1991-05-24  |  1.9 KB  |  56 lines

  1. program Beeper;
  2. uses WObjects, WinTypes, WinProcs, StdWnds;
  3. {========================================================================}
  4. function TimerMsg( Wnd: hwnd;   Msg: word;
  5.                    id: integer; Tick: longint): word; export;
  6. const
  7.    CurIntvl: integer = 950;
  8. begin
  9.    CurIntvl := 1000 - CurIntvl;
  10.    SetTimer( 0, id, CurIntvl, MakeProcInstance( @TimerMsg, hinstance));
  11.  
  12.    MessageBeep( 0);
  13.    end;
  14. {========================================================================}
  15. type
  16.    { Declare TBeeperWindow, a TWindow descendant }
  17.    PBeeperWindow = ^TBeeperWindow;
  18.    TBeeperWindow = object(TWindow)
  19.    end;
  20. {========================================================================}
  21. type
  22.    { Declare TBeeperApp, a TApplication descendant }
  23.    TBeeperApp = object(TApplication)
  24.       destructor Done; virtual;
  25.       procedure InitInstance; virtual;
  26.       procedure InitMainWindow; virtual;
  27.       private
  28.          TimerId: word;
  29.       end;
  30.    {---------------------------------------------------------------------}
  31.    destructor TBeeperApp.Done;
  32.    begin
  33.       KillTimer( 0, TimerId);
  34.       TApplication.Done;
  35.    end;
  36.    {---------------------------------------------------------------------}
  37.    procedure TBeeperApp.InitInstance;
  38.    begin
  39.       TApplication.InitInstance;
  40.       TimerId := SetTimer( 0, 1, 1000,
  41.                            MakeProcInstance( @TimerMsg, hinstance));
  42.       end;
  43.    {---------------------------------------------------------------------}
  44.    procedure TBeeperApp.InitMainWindow;
  45.    begin
  46.       MainWindow := New( PBeeperWindow, Init( NIL, 'Roadrunner'));
  47.       end;
  48. {========================================================================}
  49. var
  50.    BeeperApp : TBeeperApp;             { create the application          }
  51. begin
  52.    BeeperApp.Init('Beeper');
  53.    BeeperApp.Run;
  54.    BeeperApp.Done;
  55.    end.
  56.